core: Look up refs like origin/foo correctly again
authorColin Walters <walters@verbum.org>
Fri, 24 Feb 2012 21:08:34 +0000 (16:08 -0500)
committerColin Walters <walters@verbum.org>
Fri, 24 Feb 2012 21:08:34 +0000 (16:08 -0500)
We want to support both "bare" lookups where "foo" can be local, or in
any remote, as well as prefixed ones for a specific remote.

This fixes ostree-pull noticing that nothing has changed.

src/libostree/ostree-repo.c
src/ostree/ostree-pull.c

index 67057d52ecd9931e739e46fb557f3d4b0a57c6d4..17f3c7b48112dd710623c8ea862addfe812c122c 100644 (file)
@@ -384,19 +384,26 @@ ostree_repo_resolve_rev (OstreeRepo     *self,
         {
           g_clear_object (&child);
 
-          if (!find_rev_in_remotes (self, rev, &child, error))
-            goto out;
+          child = g_file_resolve_relative_path (priv->remote_heads_dir, rev);
 
-          if (child == NULL)
+          if (!g_file_query_exists (child, NULL))
             {
-              if (!allow_noent)
+              g_clear_object (&child);
+              
+              if (!find_rev_in_remotes (self, rev, &child, error))
+                goto out;
+              
+              if (child == NULL)
                 {
-                  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                               "Rev '%s' not found", rev);
-                  goto out;
+                  if (!allow_noent)
+                    {
+                      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                                   "Rev '%s' not found", rev);
+                      goto out;
+                    }
+                  else
+                    g_clear_object (&child);
                 }
-              else
-                g_clear_object (&child);
             }
         }
 
index c088cb5396ead06a760fa458b9814bdb311948dd..3b929435e0fc5c09ed967dbd32c99e9d386d9b9b 100644 (file)
@@ -463,7 +463,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
   OstreeRepo *repo = NULL;
   const char *remote;
   const char *branch;
-  char *remote_branch_ref_path = NULL;
   char *key = NULL;
   char *baseurl = NULL;
   char *refpath = NULL;
@@ -566,7 +565,6 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
   g_free (original_rev);
   g_free (baseurl);
   g_free (refpath);
-  g_free (remote_branch_ref_path);
   g_clear_object (&soup);
   if (base_uri)
     soup_uri_free (base_uri);